export default class Queue<T> {
    private data: T[] = [];

    public get length() {
        return this.data.length;
    }

    public in(item: T) {
        this.data.unshift(item);
    }

    public out(): T | undefined {
        return this.data.pop();
    }

    public front(): T | undefined {
        return this.data[this.length - 1];
    }

    public behind(): T | undefined {
        return this.data[0];
    }

    public isEmpty() {
        return 0 === this.length;
    }

    public clear() {
        this.data.splice(0, this.length);
    }
}